from django.db import models

# Create your models here.

#定义用户模型类
# class User(models.Model):
#     #用户名
#     username = models.CharField(max_length=20,unique=True)
#     #密码
#     password = models.CharField(max_length=256)
#     #邮箱
#     email = models.EmailField(unique=True)
#     #默认头像
#     default_address = models.ForeignKey('Address',related_name='users',null=True,blank=True,on_delete=models.SET_NULL)
#     #默认False，是否激活
#     is_active= models.BooleanField(default=False)

#利用django自带的user
# from django.contrib.auth.models import User

#不满足需求，自定义
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
    mobile = models.CharField(unique=True,max_length=11,verbose_name='手机号')
    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name
    def __str__(self):
        return self.username